<template>
  <table class="table table-bordered table-stripped">
    <!-- 表格标题区域 -->
    <thead>
      <!-- 设置插槽 -->
      <slot name="head"></slot>
    </thead>
    <!-- 表格主体区域 -->
    <tbody>
      <tr
        v-for="(obj, index) in list"
        :key="obj.id"
      >
        <!-- 用row存储当前行对象传给template -->
        <slot
          name="body"
          :row="obj"
          :index="index"
        ></slot>
      </tr>
    </tbody>
  </table>
</template>

<script>
export default {
  name: 'MyTable',
  props: {
    list: Array
  }
}
</script>


<style scoped lang="less">
.my-goods-list {
  .badge {
    margin-right: 5px;
  }
}
</style>